home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / textual / tex / files / !tex / latexsty3 / UNDERSPC / STY
Encoding:
Text File  |  1991-02-10  |  2.1 KB  |  48 lines

  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. %
  3. % underspc.sty   24-June-89
  4. %
  5. % Jonathan Kew   (...!texbell!txsil!jon)
  6. %
  7. % LaTeX style option to allow underlining of inter-word spaces.
  8. %
  9. % This style file creates a ``magicspaces'' environment, within
  10. % which all inter-word spaces are filled with \xleaders\underbox
  11. % instead of plain glue.  All normal word and sentence spacing
  12. % rules still work (I think).  Within ``magicspaces'', a blank
  13. % line does *not* generate a paragraph break, just a normal
  14. % word space.
  15. % NOTE: spaces generated by macros which were defined outside
  16. % the environment will *not* be dealt with.
  17. % The \underbox specified here isn't what I really use: I have
  18. % a special character in my underlined fonts.
  19. %
  20. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  21. % Excuse the lack of comments.  If you want this, you can probably
  22. % figure out how it works!  (The TeXbook explains all, of course.)
  23. \def\@eat#1{\futurelet\n@xt\@@eat}
  24. \def\@@eat{{\ifx\n@xt\@spc\aftergroup\@eat\fi}}
  25. \def\@spc{\@ulspc\futurelet\n@xt\@@eat}
  26. \def\@ulspc{\ifnum\spacefactor=\@m \@@ulspc\else
  27.   \@spcwid\fontdimen2\font
  28.   \ifnum\spacefactor>1999 \advance\@spcwid\fontdimen7\font\fi
  29.   \@spcstretch\fontdimen3\font
  30.   \multiply\@spcstretch\spacefactor \divide\@spcstretch\@m
  31.   \@spcshrink\fontdimen4\font
  32.   \multiply\@spcshrink\@m \divide\@spcshrink\spacefactor
  33.   \xleaders\copy\underbox\hskip\@spcwid plus\@spcstretch minus\@spcshrink\fi}
  34. \newdimen\@spcwid \newdimen\@spcstretch \newdimen\@spcshrink
  35. \newbox\underbox
  36. \setbox\underbox=\hbox{\hskip-.05pt
  37.   \vrule width.5pt height-.8pt depth1pt\hskip-.05pt}
  38. \def\@@ulspc{\xleaders\copy\underbox\hskip\fontdimen2\font
  39.       plus\fontdimen3\font minus\fontdimen4\font\futurelet\n@xt\@@eat}
  40. \let\@space\ % remember the real control-space
  41. \def\magicspaces{\catcode`\ \active\catcode`\^^M\active%
  42.    \def~{\penalty\@M\@spc}\let\ \@@ulspc\futurelet\n@xt\@@eat}
  43. \def\endmagicspaces{\ifhmode\unskip\fi% beware of this---it could bite back
  44.    \catcode`\ 10 \catcode`\^^M5
  45.    \def~{\penalty\@M\space}\let\ \@space}
  46. {\magicspaces\global\let \@spc\global\let^^M\@spc}
  47. % End of underspc.sty
  48.